﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace tooltipslider
{
	public partial class MainControl : UserControl
	{
        private slidertooltip myslidertooltip = null;
		public MainControl()
		{
			// Required to initialize variables
			InitializeComponent();
           
		}

      

       
        public double getsliderValue()
        {
            return myslider.Value;
        }
       
       
        public void updatesliderValue(TimeSpan s)
        {
            myslider.Value = s.TotalSeconds;
            string TotalTime = s.ToString();
            string minutes = TotalTime.Substring(TotalTime.IndexOf(':') + 1, 2);
            string seconds = TotalTime.Substring(TotalTime.LastIndexOf(':') + 1, 2);
            TimeSpan ts = new TimeSpan(0, Convert.ToInt32(minutes), Convert.ToInt32(seconds));
           
            if (myslidertooltip != null)
            {
                myslidertooltip.updatetextValueforcurrent(ts.ToString());
            }
        }
        public void setmaxsliderValue(double s)
        {
            myslider.Maximum = s;
        }
		private void slidertooltip_Loaded(object sender, System.Windows.RoutedEventArgs e)
		{
            myslidertooltip = sender as slidertooltip;
		}
	}
}